<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let p = new Promise((res,rej)=>{
            rej('错误了')
            // res('成功');
        });

        // let p2 = p.then(undefined,rea=>{
        //     console.log(rea);
        // });

        // catch 捕获失败
        p.then(val=>{
            console.log(val);
        }).then(val=>{
            console.log(val);
        }).then(val=>{
            console.log(val);
        }).then(val=>{

        }).catch(rea=>{
            console.log('兜底',rea);
        })

        // 处理异常穿透
        // p.catch(rea=>{
        //     console.log(rea);
        // });
         


        // 异常穿透
        // let p2 = p.then(val=>{
        //     console.log(val);
        // });

        // console.log(p2);

        // p2.then(val=>{},rea=>{
        //     console.log(rea);
        // })
    </script>
</body>
</html>